<template>
  <div style="border: 1px solid black; padding: 10px;">
    父亲：（家庭总资产为：{{ assets.toFixed(2) }}元）
    <button @click="() => makeMoney(100)">赚钱</button>
    <button @click="() => spendMoney(50)">花钱</button>
    <Son />
    <DaughterComponent />
  </div>
</template>

<script setup lang="ts">
import { inject } from 'vue';
import Son from './Son.vue';
import DaughterComponent from './DaughterComponent.vue';

const assets = inject<number>('assets');
const makeMoney = inject<(money: number) => void>('makeMoney');
const spendMoney = inject<(money: number) => void>('spendMoney');
</script>
